/*
 * @Author: zxc
 * @Date: 2020-07-31 15:33:18
 * @LastEditTime: 2020-08-02 19:07:26
 * @LastEditors: zxc
 * @Description:函数
 */

// function adds(arg:number,arg1:number):number{
//   return arg+arg1
// }

// const addd = (arg:number,arg2:number):number => arg+arg2

let qdd: (x: number, y: number) => number;

qdd = (arg: number, arg2: number): number => arg + arg2;
qdd = (arg: number, arg2: number) => arg + arg2;

type Qdd = (x: number, y: number) => number;
// let addFun:Qdd
// addFun = (arg1:number,arg2:number) => arg1+arg2
// // type isString=string

type AddFunction = (arg1: number, arg2: number, arg3?: number) => number;
// let addFunc: AddFunction;
// addFunc = (arg1: number, arg2: number, arg3?: number) =>
//   arg1 + arg2 + (arg3 ? arg3 : 0);
// console.log(addFunc(2, 3));

// let addFunc = (x:number,y:number = 3) => x+y;
// console.log(addFunc(1))


function handelData(x:string):string[]
function handelData(x:number):number[]
function handelData(x:any):any{
  if(typeof x === 'string') {
    return x.split('')
  } else {
    return x.toString().split('').map((el: any) => Number(el))
  }
}
console.log(handelData('adf').length)
console.log(handelData(3443).map(el => el*2))